<template>
  <div class="list">
    <h1>List</h1>
    <button @click="sendDatatoParent">向父组件传递数据</button>
  </div>
</template>

<script>
export default {
  name: "List",
  data() {
    return {
      list: [
        { name: "laoli", age: 18 },
        { name: "laozhang", age: 20 },
        { name: "laowang", age: 20 },
      ],
    };
  },
  methods: {
    sendDatatoParent() {
      this.$emit("atguigu", this.list);
    },
  },
};
</script>

<style scoped>
.list {
  height: 200px;
  background: pink;
}
</style>